home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 441 / aessrc12 / aesutob4.s < prev    next >
Text File  |  1990-11-23  |  3KB  |  77 lines

  1.  
  2. ;*========================================================================
  3. ;*
  4. ;* AESFAST Public Domain GEM bindings.
  5. ;*  
  6. ;*========================================================================
  7.  
  8. ;*************************************************************************
  9. ;*
  10. ;* AESUTOB4.S - Object-related utilities 4 of n.
  11. ;*  Non-standard utility functions.
  12. ;*
  13. ;*************************************************************************
  14.          
  15.           .include  "gemfast.sh"        ; Pull in header file.
  16.  
  17. ;-------------------------------------------------------------------------
  18. ; objrb_which - Return index of selected radio button, -1 if none selected.
  19. ;         
  20. ;               More generally speaking, this returns the index of the first 
  21. ;               child of the specified parent which has a SELECTED bit set. 
  22. ;
  23. ;  int objrb_which(tree, parentobj);
  24. ;-------------------------------------------------------------------------
  25.  
  26. _objrb_which::
  27.           .cargs    #4,.ptree.l,.obj
  28.           move.l    .ptree(sp),a0
  29.           move.w    .obj(sp),d2
  30.           move.w    d2,d0
  31.           muls      #OBJ_SIZ,d0
  32.           move.w    ob_head(a0,d0.l),d0
  33.           bmi.s     .notfound
  34. .loop:
  35.           move.w    d0,d1
  36.           muls      #OBJ_SIZ,d1
  37.           btst.b    #BSELECTED,ob_state+1(a0,d1.l)
  38.           bne.s     .done
  39.           move.w    ob_next(a0,d1.l),d0
  40.           cmp.w     d0,d2
  41.           bne.s     .loop
  42. .notfound:
  43.           moveq.l   #-1,d0
  44. .done:
  45.           tst.w     d0                  ; insure CCR return matches d0
  46.           rts
  47.           
  48. ;-------------------------------------------------------------------------
  49. ; obj_parent - Find the parent of a given object.
  50. ;              By definition, the root object has no parent, 0 is returned.
  51. ;              An unusual object tree could throw this routine into a loop,
  52. ;              but in a standard tree, all the next/tail pointers should
  53. ;              be in good shape, and a parent will be found.
  54. ;
  55. ;             
  56. ;  int obj_parent(tree, cur_object);
  57. ;-------------------------------------------------------------------------
  58.  
  59. _obj_parent::
  60.           .cargs    #4,.ptree.l,.obj.w
  61.           
  62.           move.l    .ptree(sp),a0
  63.           move.w    .obj(sp),d0
  64.           beq.s     .done
  65. .loop:
  66.           move.w    d0,d2
  67.           muls      #OBJ_SIZ,d0
  68.           move.w    ob_next(a0,d0.l),d1
  69.           move.w    d1,d0
  70.           muls      #OBJ_SIZ,d1
  71.           cmp.w     ob_tail(a0,d1.l),d2
  72.           bne.s     .loop
  73. .done:
  74.           tst.w    d0
  75.           rts
  76.           
  77.